<!-- 底部按钮组件 -->
<template>
	<view>
		<block v-if="list.length">
			<view class="item" v-for="item,index in list" :key="index">
				<avatar class="avatar" :src="item.headPortrait"></avatar>
				<view class="other">
					<view class="info">
						<view class="name">
							{{item.nickName}}
						</view>
						<view class="zan" @click="$emit('isGreat',item.id,index)">
							<view class="icon">
								<image v-if="item.greatFlag==0" src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/common/zan.png" mode=""></image>
								<image v-else src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/common/zan1.png" mode=""></image>
							</view>
							<text class="txt">{{item.greatNum}}</text>
						</view>
					</view>
					<view class="conent">
						{{item.content}}
					</view>
					<view class="relay">
						<view class="time">
							{{item.createTime}} {{item.lastLoginAddress}}
						</view>
						<view class="re" @click="$emit('sendCom',item)">
							回复
						</view>
					</view>
					<view class="relays" v-if="item.commentNum">
						<view class="hand" v-if="!item.open" @click="$emit('openRelay','open',item,index)">
							展开{{item.commentNum}}条回复<u-icon name="arrow-down"></u-icon>
						</view>
						<view class="re_list" v-if="item.open">
							<view class="re_item" v-for="cell,idx in item.relays">
								<view class="left">
									<avatar :src="cell.headPortrait" style="width: 40rpx;height: 40rpx;"></avatar>
								</view>
								<view class="right">
									<view class="nick">
										{{cell.nickName}}
									</view>
									<view class="con">
										{{cell.content}}
									</view>
									<view class="times">
										{{cell.createTime}} {{cell.lastLoginAddress}}
									</view>
								</view>
							</view>
							<view class="hand" v-if="item.open" @click="$emit('openRelay','close',item,index)">
								收起<u-icon name="arrow-up"></u-icon>
							</view>
						</view>
					</view>
				</view>
				<view class="line"></view>
			</view>
		</block>
		<!-- 发表评论图标 -->
		<view class="comments" @click="$emit('sendCom',null)">
			<image src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/comments.png"></image>
			<view class="publish">发表评论</view>
		</view>
	</view>
</template>

<script>
	import {
		childComment
	} from '@/apis/apis.js'
	import avatar from '@/components/avatar.vue'
	export default {
		components: {
			avatar
		},
		props: {
			list: {
				type: Array,
				default: []
			}
		},
		data() {
			return {
				relays: []
			}
		},
		methods: {},
	}
</script>

<style scoped lang="scss">

	.item {
		width: 100%;
		margin: 15rpx 0;
		display: flex;

		&>.avatar {
			width: 70rpx;
			height: 70rpx;
			border-radius: 50%;
			margin-right: 20rpx;
		}

		.other {
			width: calc(100% - 90rpx);
			display: flex;
			flex-direction: column;
				word-break: break-all;
			.info {
				flex: 1;
				display: flex;
				justify-content: space-between;
				align-items: center;
				font-size: 26rpx;
				color: #747474;
				line-height: 53rpx;

				.name {
					font-size: 28rpx;
					font-weight: 500;
				}

				.zan {
					.icon {
						display: inline-block;
						width: 27rpx;
						height: 26rpx;

						&>image {
							width: 100%;
							height: 100%;
						}
					}

					.txt {
						padding-left: 10rpx;
						font-size: 28rpx;
						font-weight: 400;
						color: #818181;
					}
				}
			}

			.content {
				width: 100%;
				font-size: 30rpx;
				color: #2B2B2B;
				line-height: 44rpx;
			}

			.relay {
				font-size: 26rpx;
				font-weight: 500;
				color: #B4B4B4;
				line-height: 53rpx;
				display: flex;

				.time {
					margin-right: 70rpx;
				}

				.re {
					color: #878787;
				}
			}

			.relays {
				.hand {
					display: flex;
					margin: 20rpx 0;
					font-size: 28rpx;
					font-weight: 500;
					color: #878787;
					line-height: 30rpx;
				}

				.re_list {
					.re_item {
						display: flex;
						margin-top: 15rpx;

						.left {
							margin-right: 16rpx;
						}

						.right {
							flex: 1;
						}

						.nick {
							font-size: 26rpx;
							color: #747474;
							line-height: 53rpx;
						}

						.con {
							font-size: 30rpx;
							color: #2B2B2B;
							line-height: 44rpx;
							word-break: break-all;
						}

						.times {
							font-size: 26rpx;
							font-weight: 500;
							color: #B4B4B4;
							line-height: 53rpx;
						}
					}
				}
			}
		}

		.line {
			width: 0%;
			height: 10rpx;
			background-color: #f8f8f8;
		}
	}

	.comments {
		display: flex;
		flex-direction: column;
		align-items: center;
		position: fixed;
		bottom: 160rpx;
		right: 18rpx;
		z-index: 999;

		&>image {
			width: 54rpx;
			height: 60rpx;
			margin-bottom: 4rpx;
		}

		.publish {
			// width: 96rpx;
			height: 36rpx;
			background: linear-gradient(-45deg, #44A3FF, #69C1FF);
			border-radius: 18rpx;
			line-height: 36rpx;
			text-align: center;
			font-size: 22rpx;
			font-family: Source Han Sans CN;
			padding: 0 4rpx;
			color: #FFFFFF;
		}
	}
</style>
